script_enemy_main{

let angle=rand(0,360);

let color=GetArgument;
color=(color-1)*40;
let grow=0;

let usespell=0;
let frame=0;
let time=0;
let miny=GetClipMinY; let maxy=GetClipMaxY; let minx=GetClipMinX; let maxx=GetClipMaxX;
let cx=GetCenterX; let cy=GetCenterY;

let SEdeath=("script\SoundEffects\enemydeath1.wav");
let SEshots5=("script\SoundEffects\shots5.wav");

let GRfamiliar=("\script\Images\OtherEffects\Chips.png");

@Initialize{
	LoadGraphic("\script\Images\OtherEffects\Chips.png");

	LoadSE("script\SoundEffects\enemydeath1.wav");
	LoadSE("script\SoundEffects\shots5.wav");

	SetScore(100);
	SetLife(20);
	SetDamageRate(10,10);
	MagicCircle(false);
}
	
@MainLoop{

SetCollisionA(GetX,GetY,grow*18);
SetCollisionB(GetX,GetY,grow*18);

if(GetX<=minx-32 || GetX>=maxx+32 || GetY<=miny-32 || GetY>=maxy+32 && time>=60){ VanishEnemy; }

let color=0;
if(GetArgument==1){ color=49; }
if(GetArgument==2){ color=50; }
if(GetArgument==3){ color=51; }
if(GetArgument==4){ color=53; }
if(GetArgument==5){ color=56; }
if(GetArgument==6){ color=57; }



if(GetCommonData("Difficulty")==1){
	if((time+16)%32==0){
	let angle=rand(0,360);
		loop(12){
		CreateShot02(GetX+10*cos(angle),GetY+10*sin(angle),0,angle,0.006,1,color,10);
		angle+=360/12;
		}
	PlaySE(SEshots5);
	}
} //Easy


if(GetCommonData("Difficulty")==2){
	if((time+14)%28==0){
	let angle=rand(0,360);
		loop(12){
		CreateShot02(GetX+10*cos(angle),GetY+10*sin(angle),0,angle,0.007,1.2,color,10);
		angle+=360/12;
		}
	PlaySE(SEshots5);
	}
} //Normal


if(GetCommonData("Difficulty")==3){
	if((time+12)%24==0){
	let angle=rand(0,360);
		loop(12){
		CreateShot02(GetX+10*cos(angle),GetY+10*sin(angle),0,angle,0.008,1.3,color,10);
		angle+=360/12;
		}
	PlaySE(SEshots5);
	}
} //Hard


if(GetCommonData("Difficulty")==4){
	if((time+10)%20==0){
	let angle=rand(0,360);
		loop(12){
		CreateShot02(GetX+10*cos(angle),GetY+10*sin(angle),0,angle,0.01,1.5,color,10);
		angle+=360/12;
		}
	PlaySE(SEshots5);
	}
} //Lunatic



if(grow<1){ grow+=0.1; }

time++;
frame++;

}

@DrawLoop{
	SetGraphicScale(grow,grow);
	SetTexture(GRfamiliar);
	SetGraphicAngle(0,0,time*5);
	SetColor(255,255,255);
	SetRenderState(ALPHA);
	SetGraphicRect(0+color,0,40+color,40);
	DrawGraphic(GetX,GetY);
}

@Finalize{
if(BeVanished==false){ PlaySE(SEdeath); }
}

}